<link href="static/plugins/bootstarp-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet">
<style>
    .row1{
        margin-top:10px;
    }
    label{
        text-align: center;
    }
</style>
<div id="studentGoManage">
    <form id="setting" method="post" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$admin.id}">
        <div class="row row1">
            <label class="col-sm-5 control-label">姓名：</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" name="name" value="{$admin.relname}">
            </div>
        </div>
    <div class="row row1">
        <label class="col-sm-5 control-label">电话：</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" readonly name="phone" value="{$admin.username}">
        </div>
    </div>
        <div class="row row1">
            <label class="col-sm-5 control-label">头像</label>
            <div class="col-sm-5">
                <input onchange="aaaaa(this);" type="file" name="pic" />
                <span style="color: gray;font-size: 12px;">不上传默认不修改</span>
                </div>
        </div>
        <br/>
        {if $admin.avatar==""}
        <div id="androimg" style="text-align: center"><img src="static/img/userpic/avatar.jpg" height="150" /><br/>
            <span style="color: gray;font-size: 13px">默认头像</span></div>
        {else}
        <div id="androimg" style="text-align: center"><img src="{$admin.avatar}" height="150" /></div>
        {/if}
    </form>
</div>
<script>
    $('#regtimeSet').datepicker({
        format : "yyyy-mm-dd",
        todayBtn : "linked",
        autoclose : true,
        todayHighlight : true,
        clearBtn : true
    });
    function aaaaa(file) {
        var prevDiv = document.getElementById('androimg');
        if (file.files && file.files[0])
        {
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150"/>';
            };
            reader.readAsDataURL(file.files[0]);
        }
        else
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }
</script>
